package org.fao.pims.web.manage.book;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class BookForm extends ActionForm {
	
	private String name = "";
	private String scientificName = "";
	
	
	public String getScientificName() {
		return scientificName;
	}

	public void setScientificName(String scientificName) {
		this.scientificName = scientificName;
	}
	
	
	
	public void reset(ActionMapping mapping, HttpServletRequest request)
	{
		
		scientificName = "";
		
	}
	
	public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
	{
		ActionErrors errors = new ActionErrors();
		
		
		if( (scientificName == null) || scientificName.trim().equals(""))
		{
			errors.add("scientificName", new ActionMessage("manage.book.scientificName.blank"));
		}
		
		return errors;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	

	


}
